package cn.good.yan.handler;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

/**
 * 重写 RequestOriginParser接口，实现 parseOrigin，来告诉我们资源地址，request接口包含哪些参数，进行放行还是限制
 *
 * @author shengren.yan
 * @create 2024-05-20
 */
@Component
public class MyRequestOriginParser implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest request) {
        return request.getParameter("serverName");
    }

}